package com.micro.ai.gateway.config;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

/**
 * 签名验证配置属性（支持从Nacos动态刷新）
 * 
 * @author micro-ai
 * @since 0.0.1
 * @version 1.0
 */
@Data
@Component
@RefreshScope
@ConfigurationProperties(prefix = "signature")
public class SignatureProperties {

    /**
     * 是否启用签名验证
     */
    private boolean enabled = false;

    /**
     * 签名有效期（秒）
     */
    private long timeout = 300;

    /**
     * 签名密钥
     */
    private String secretKey = "micro-ai-default-signature-secret-key-2024";

    /**
     * 跳过签名验证的路径列表（支持从Nacos动态刷新）
     */
    private List<String> skipSignaturePaths = new ArrayList<>();

    /**
     * 初始化默认值
     */
    public SignatureProperties() {
        // 默认跳过签名验证的路径
        skipSignaturePaths.add("/api/auth/login");
        skipSignaturePaths.add("/api/auth/register");
        skipSignaturePaths.add("/api/auth/captcha");
        skipSignaturePaths.add("/actuator/health");
        skipSignaturePaths.add("/actuator/info");
    }
}

